//
//  dzTableViewCell.m
//  tongxiangOASystem
//
//  Created by michael on 2017/4/24.
//  Copyright © 2017年 czd. All rights reserved.
//

#import "dzTableViewCell.h"
#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
@implementation dzTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {

//        [self createUI];

          self.selectionStyle = UITableViewCellSelectionStyleNone;
//    self.contentView.layer.borderWidth = 5;
//      UIColor *myColor = [UIColor colorWithWhite:0.5 alpha:0.2];
//    
//self.contentView.layer.borderColor = [myColor CGColor];
self.bgView  = [[UIView alloc]init];

     _label1 = [[UILabel alloc]init];
    _label1.frame = CGRectZero;
    
      [_label1 setFont:[UIFont systemFontOfSize:14]];
       [self.bgView addSubview:_label1];
    
       _label2 = [[UILabel alloc]init];
    _label2.frame = CGRectZero;
    _label2.numberOfLines = 0;
      [_label2 setFont:[UIFont systemFontOfSize:15]];
       [self.bgView addSubview:_label2];
    
       _label3 = [[UILabel alloc]init];
    _label3.frame = CGRectZero;
      [_label3 setFont:[UIFont systemFontOfSize:13]];
       [self.bgView addSubview:_label3];
    
       _label4 = [[UILabel alloc]init];
    _label4.frame = CGRectZero;
      [_label4 setFont:[UIFont systemFontOfSize:13]];
       [self.bgView addSubview:_label4];
    
//       _label5 = [[UILabel alloc]init];
//    _label5.frame = CGRectZero;
//      [_label5 setFont:[UIFont systemFontOfSize:13]];
//       [self.bgView addSubview:_label5];
    
}

return self;

}
- (void)layoutSubviews{
[super layoutSubviews];
 
//创建一个UIView比self.contentView小一圈
  
    CGFloat  titleFloat  = [OAToolBox sizebyText:_dic[@"subject"] font:15 minsWidth:60];
    self.bgView.frame =  CGRectMake(10, 5, SCREEN_WIDTH - 20, titleFloat+60);
    self.bgView.backgroundColor = [UIColor whiteColor];
    //给bgView边框设置阴影
    self.bgView.layer.shadowOffset = CGSizeMake(1,1);
    self.bgView.layer.shadowOpacity = 0.3;
    self.bgView.layer.shadowColor = [UIColor blackColor].CGColor;
        self.bgView.layer.cornerRadius = 5;

    [self.contentView addSubview:self.bgView];

_label1.frame =CGRectMake(10, 5,20, 20);
      UIColor *myColor = [UIColor colorWithWhite:0.5 alpha:0.2];
_label1.textAlignment = 1;
_label1.backgroundColor = myColor;
_label1.layer.cornerRadius = 10;
_label1.clipsToBounds = YES;
_label1.text = _number;
_label1.textColor = [UIColor blueColor];
_label2.frame =CGRectMake(_label1.right+5, 5,kScreenWidth-60, titleFloat);
_label2.text = _dic[@"subject"] ;
//_label2.backgroundColor = [UIColor redColor];
_label2.textColor = [UIColor blueColor];
_label3.frame =CGRectMake(_label1.right+5, _label2.bottom+10, kScreenWidth-40, 15);
//_label3.backgroundColor = [UIColor greenColor];
_label4.frame =CGRectMake(_label1.right+5, _label3.bottom, kScreenWidth-40, 15);
_label5.frame =CGRectMake(_label1.right+5, _label4.bottom, kScreenWidth-40, 15);
if(![_adic[@"file2"]isEqualToString:@""]){
_label3.text = [NSString stringWithFormat:@"%@:  %@", _adic[@"file2"],_dic[@"file2"]];}
if(_adic[@"file1"]){
_label4.text = [NSString stringWithFormat:@"%@:  %@", _adic[@"file1"],_dic[@"file1"]];}
if(_adic[@"file"]){

_label5.text = [NSString stringWithFormat:@"%@:  %@", _adic[@"file"],_dic[@"file"]];
}

}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
